@include('admin.header')
<style type="text/css">
.pic-list li {
	margin-bottom: 5px;
}
</style>

<link rel="stylesheet" type="text/css" href="/static/js/webuploader/0.1.5/style.css"/>
<link rel="stylesheet" type="text/css" href="/static/js/webuploader/0.1.5/webuploader.css"/>
<script type="text/javascript" src="/static/js/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/static/js/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="/static/js/ueditor/1.4.3/ueditor.all.js"> </script>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="/banner/bannerList">编辑评论</a></li>
		</ul>
		<form method="post" class="form-horizontal js-mobile-add-form" enctype="multipart/form-data">
			<div class="row-fluid">
				<table class="table table-bordered">
					
					<tr>
						<th width="100">评价总分</th>
						<td>
							<input type="text" style="width:200px;" name="score" id="score"  value="{{$data->score or '' }}" />
						</td>
					</tr>
				
					<tr>
						<th>评论方式</th>
						<td>
							<select id="is_cryptonym"  name="is_cryptonym">
								<option value="1" @if($id >0) @if($data->is_cryptonym == 1) selected="selected" @endif @endif>匿名</option>
								<option value="0" @if($id >0) @if($data->is_cryptonym == 2) selected="selected" @endif @endif>实名</option>
							</select>
						</td>
					</tr>
					</tr>
					<tr>
						<th>内容</th>
						<td>
							<textarea name="cont" id="cont" style="width: 400px;height: 130px;" value="">{{$data->content or '' }}</textarea>
						</td>
					</tr>

				</table>
			</div>
			<div class="form-actions">
				<input type="hidden" name="id" value="{{$data->id or 0}}"/>
 				<input type="hidden" name="_token"  value="{{csrf_token()}}"/>
				<button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
				<a class="btn" href="{{asset('comment/List')}}">返回</a>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="/static/js/common.js"></script>
	<script type="text/javascript" src="/static/js/validate/validate.js"></script>
	<script type="text/javascript">
		$(function() {
			//初始化UE编辑器
			UE.getEditor('editor');
			$(".js-mobile-add-form").validate({
				rules: {
					cont: {
						required: true
					}
				},
				messages: {
					cont: {
						required: "评论内容不能为空"
					}
				},
				submitHandler: function () {
					var data = $('.js-mobile-add-form').serialize();
					$.post("/comment/{{$action}}",data, function (msg) {
						if (msg.status == 1) {
							layer.confirm(msg.info, {
								btn: ['确定']
							}, function(){
								@if($action == 'bannerAdd')
										window.location.href="{{asset('comment/List')}}";
								@else
										window.location.href="{{asset('comment/List')}}";
								@endif
							});
						} else {
							layer.alert(msg.info, {
								title: '提示',
								icon: 2,
							});
						}
					}, 'json');
					return false;
				}
			});

		});


	</script>
</body>
</html>